//
//  YGSubscribeCollectionViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/23.
//

#import "YGSubscribeCollectionViewCell.h"
#import "YGScienceLowerTypeView.h"

@interface YGSubscribeCollectionViewCell ()

//@property (nonatomic, strong) UIButton *lowerTypeBtn;
@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *lowerTypeLabel;

@end

@implementation YGSubscribeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initconstraints];
    }
    return self;
}

-(void)initView{
    [self addSubview:self.imgView];
    [self addSubview:self.lowerTypeLabel];
}

-(void)initconstraints{

    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.mas_centerX);
            make.width.mas_equalTo(50);
            make.height.mas_equalTo(50);
    }];
    
    [self.lowerTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.imgView.mas_bottom).offset(5);
            make.centerX.mas_equalTo(self.mas_centerX);
            make.width.mas_equalTo(self.mas_width);
            make.height.mas_equalTo(12);
    }];
}

- (void)configurfeModel:(YGScienceCenterSubscribeArrayModel *)model{
    self.lowerTypeLabel.text = model.name;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.imgUrl]];
}
#pragma event
-(void)clickLowerTypeAction{
    
}

#pragma setter


- (UIImageView *)imgView{
    if (!_imgView) {
        _imgView = [[UIImageView alloc]init];
        _imgView.layer.cornerRadius = 8;
        _imgView.clipsToBounds = YES;
    }
    return _imgView;
}

- (UILabel *)lowerTypeLabel{
    if (!_lowerTypeLabel) {
        _lowerTypeLabel = [[UILabel alloc]init];
        _lowerTypeLabel.font = [UIFont systemFontOfSize:12];
        _lowerTypeLabel.textColor = UIColorFromRGB(0x333333);
        _lowerTypeLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _lowerTypeLabel;
}


@end
